package com.mhkj.common.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置
 * @author mics
 * @date 2018年6月13日
 * @version 1.0
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer{
	 @Bean
	    public HandlerInterceptor getMyInterceptor(){
	        return new LoginInterceptor();
	    }
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
        //InterceptorRegistration interceptorRegistration = registry.addInterceptor(new LoginInterceptor());
        
		InterceptorRegistration interceptorRegistration=registry.addInterceptor(getMyInterceptor());
       //排除路径
        interceptorRegistration.excludePathPatterns("/login");
        interceptorRegistration.excludePathPatterns("/planNode/listAll");
        interceptorRegistration.excludePathPatterns("/welcome.html");
        interceptorRegistration.excludePathPatterns("/login.html");
        interceptorRegistration.excludePathPatterns("/error.html");
        interceptorRegistration.excludePathPatterns("**/workflow.html");
        interceptorRegistration.excludePathPatterns("/image/**");
        interceptorRegistration.excludePathPatterns("/scripts/**");
        interceptorRegistration.excludePathPatterns("/ftp/ftpFileUpload");
        interceptorRegistration.excludePathPatterns("/workFlowLogger/getJumpUrlByWorkFlowId");
        //包含路径
        interceptorRegistration.addPathPatterns("/");
        interceptorRegistration.addPathPatterns("/**");
    }
	
}
